<template>
  <ScreenModal
    :width="screenModal"
    title="小区点位详情"
    v-model="isVisible"
  >
    <div class="spring_box">
      <div class="spring_top spring_content">
        <div class="spring_bottom_box">
          <div class="spring_top_title">
            <div class="spring_top_tag">
              <span class="active_title">基本情况</span>
              <span class="active_tab"></span>
            </div>
          </div>

          <div class="spring_top_text">
            <p>{{ xiaoquData.name }}</p>
            <p>
              <span>地理位置：</span>
              {{ xiaoquData.address }}
            </p>
            <p>
              <span>小区规模：</span>
              建筑面积{{ xiaoquData.totalReformArea }}万㎡
            </p>
            <p>
              <span>预计投资：</span>
              {{ xiaoquData.money }}元
            </p>
          </div>
        </div>

        <div class="spring_bottom_box">
          <div class="spring_top_title">
            <div class="spring_top_tag">
              <span class="active_title">现状分析</span>
              <span class="active_tab"></span>
            </div>
          </div>
          <div class="spring_top_content">
            <div v-if="xiaoquData.analysis">{{ xiaoquData.analysis }}</div>
            <div
              class="spring_top_img"
              v-else
            >
              <div>
                <img
                  alt
                  height="172"
                  src="../assets/images/default-img.png"
                  srcset
                  width="194"
                />
                <span>暂无数据</span>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div
        class="spring_right"
        v-if="scrollData.length"
      >
        <div class="spring_right_title">相关案件列表</div>
        <div class="mg-t-30">
          <ZuiXinAnJian
            :classOption="classOption"
            :isImg="false"
            :scrollData="scrollData"
            :servers="3"
          ></ZuiXinAnJian>
        </div>
      </div>
    </div>
  </ScreenModal>
</template>

<script>
import ZuiXinAnJian from './ZuiXinAnJian/ZuiXinAnJian.vue'
import { LaoJiuXiaoQuDB } from '@/api'

export default {
  name: 'popup',
  components: {
    ZuiXinAnJian
  },
  data() {
    return {
      isVisible: false,
      list: [],
      xiaoquData: {},
      classOption: {
        singleHeight: 154,
        direction: 1
      },
      scrollData: []
    }
  },
  computed: {
    screenModal() {
      return this.scrollData.length > 0 ? 1280 : 792
    }
  },
  methods: {
    open(e) {
      this.code = e.number
      this.title = e.title
      this.isVisible = true
      this.getCommunityInfo(e.id)
    },
    getCommunityInfo(id) {
      const data = {
        id: id
      }
      LaoJiuXiaoQuDB.getCommunityInfo(data).then(res => {
        this.xiaoquData = res.data
        this.scrollData = res.data.order.map(item => {
          return {
            ...item,
            staLink: item.sta_link, //状态
            createTime: item.create_time
          }
        })
      })
    },

    getYMD(data) {
      let myDate = new Date(data)
      let myMonth = myDate.getMonth() + 1 //获取当前月份(0-11,0代表1月)
      let myToday = myDate.getDate() //获取当前日(1-31)
      myMonth = myMonth > 9 ? myMonth : '0' + myMonth
      myToday = myToday > 9 ? myToday : '0' + myToday
      let nowDate = myMonth + '/' + myToday
      return nowDate
    }
  }
}
</script>

<style lang="less" scoped>
.spring_box {
  width: 100%;
  height: 100%;
  padding-top: 40px;
  display: flex;
  // flex-direction: column;
  .spring_content {
    width: 727px;
    background: linear-gradient(0deg, rgba(18, 81, 210, 0.3), rgba(33, 158, 255, 0.1));
    border: 1px solid #219eff;
    border-radius: 10px;
    padding: 20px 30px;
    .spring_top_text {
      padding: 30px 0 40px;
      p {
        font-size: 14px;
        font-family: Noto Sans S Chinese;
        font-weight: 400;
        color: #ffffff;
        margin-bottom: 20px;
        span {
          color: #9ed5ff;
        }
      }
      p:nth-child(1) {
        font-size: 18px;
        font-family: Noto Sans S Chinese;
        font-weight: 400;
        color: #25ffe8;
      }
      p:nth-child(4) {
        margin-bottom: 0;
      }
    }

    .spring_bottom_box {
      flex: 1;
    }
    .spring_top_title {
      width: 100%;
      border-bottom: 1px solid rgba(185, 224, 255, 0.2);

      .spring_top_tag {
        width: 64px;
        margin-right: 30px;
        text-align: center;
        span {
          display: inline-block;
        }
        .active_title {
          font-size: 16px;
          font-family: Source Han Sans SC;
          font-weight: 500;
          color: #ffffff;
        }
        .active_tab {
          width: 28px;
          height: 4px;
          margin-top: 12px;
          background: #17a7eb;
        }
        .active {
          font-size: 14px;
          font-family: Source Han Sans SC;
          font-weight: 400;
          color: #75aada;
        }
      }
    }
    .spring_top_content {
      font-size: 14px;
      font-family: Noto Sans S Chinese;
      font-weight: 400;
      color: #9ed5ff;
      line-height: 24px;
      padding: 20px 0 16px;
      .spring_top_img {
        div {
          text-align: center;
          margin-top: 20px;
          span {
            display: block;
          }
        }
      }
    }
  }

  .spring_right {
    width: 458px;
    margin-left: 30px;
    &_title {
      width: 458px;
      height: 50px;
      background: rgba(31, 73, 135, 0.6);
      border: 1px solid rgba(33, 158, 255, 0.3);
      font-size: 18px;
      font-family: Noto Sans S Chinese;
      font-weight: 400;
      color: #ffffff;
      text-align: center;
      line-height: 50px;
    }
  }
}
</style>